﻿<%@ Page Title="Quản lý dự án | VNT Việt Nam" Language="C#" MasterPageFile="~/Admin.master"
    AutoEventWireup="true" CodeFile="DuAn.aspx.cs" Inherits="DuAn" %>

<%@ Register Assembly="DropDownCheckBoxes" Namespace="Saplin.Controls" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        .padding
        {
            margin-left: 5px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>
            <div class="panel panel-success margin">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        Quản lý dự án</h3>
                </div>
                <div class="panel-body">
                    <table width="100%">
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Mã dự án</span><br />
                                <asp:TextBox ID="txtMaDA" ReadOnly="true" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator2" runat="server"
                                    ControlToValidate="txtMaDA" ErrorMessage="Nhập mã dự án" Display="None" Text="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Tên dự án</span><br />
                                <asp:TextBox ID="txtTenDuAn" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="txtTenDuAn" ErrorMessage="Nhập tên dự án" Display="None" Text="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Địa điểm</span><br />
                                <asp:TextBox ID="txtDiaDiem" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator3" runat="server"
                                    ControlToValidate="txtDiaDiem" ErrorMessage="Nhập địa điểm dự án" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Chủ đầu tư</span><br />
                                <asp:TextBox ID="txtChuDauTu" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator4" runat="server"
                                    ControlToValidate="txtChuDauTu" ErrorMessage="Nhập tên chủ đầu tư dự án" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Nhân viên tham gia dự án</span><br />
                                <asp:DropDownCheckBoxes CssClass="form-control" ID="dlNhanVienThamGiaDuAn" runat="server"
                                    AddJQueryReference="True" UseButtons="True" Width="100%" UseSelectAllNode="True"
                                    DataTextField="HoTen" DataSourceID="objNhanVien" DataValueField="IDs">
                                    <Style2 DropDownBoxBoxWidth="100%" />
                                    <Texts SelectBoxCaption="Chọn nhân viên" />
                                    
                                </asp:DropDownCheckBoxes>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Chọn nhà thầu - gói thầu - kỹ sư giám sát</span><br />
                                <asp:GridView ID="GridView1" Visible="true" AutoGenerateColumns="false" runat="server"
                                    BackColor="White" Font-Size="14px" Width="100%" BorderColor="#CCCCCC" EmptyDataText="Không có dữ liệu nào"
                                    BorderStyle="None" BorderWidth="1px" CellPadding="3" EnableModelValidation="True"
                                    Font-Names="Tahoma" onrowdeleting="GridView1_RowDeleting">
                                    <Columns>
                                        <asp:BoundField DataField="RowNumber" HeaderText="STT" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                                        <asp:TemplateField HeaderText="Nhà thầu" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:DropDownList CssClass="form-control" Style="line-height: 30px;" DataTextField="TenNhaThau"
                                                DataValueField="IDs" ID="dlNhaThau" DataSourceID="objNhaThau" Width="95%" runat="server">
                                            </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Gói thầu" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:DropDownCheckBoxes CssClass="form-control"  AppendDataBoundItems="true" ID="dlGoiThau" runat="server" AddJQueryReference="True"
                                                    UseButtons="True" Width="90%"  DataSourceID="objGoiThau" DataTextField="TenGoiThau" DataValueField="IDs"
                                                     UseSelectAllNode="True">
                                                    <Style2 DropDownBoxBoxWidth="90%" />
                                                    <Texts SelectBoxCaption="Chọn gói thầu" />
                                                </asp:DropDownCheckBoxes>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Kỹ sư giám sát" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:DropDownCheckBoxes CssClass="form-control" ID="dlKySu" runat="server" AddJQueryReference="True"
                                                    UseButtons="True" Width="99%" DataTextField="HoTen" DataValueField="IDs" DataSourceID="objNhanVien"
                                                    UseSelectAllNode="True">
                                                    <Style2 DropDownBoxBoxWidth="99%" />
                                                    <Texts SelectBoxCaption="Chọn kỹ sư giám sát" />
                                                </asp:DropDownCheckBoxes>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Tư vấn trưởng" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:DropDownCheckBoxes CssClass="form-control" ID="dlTuVanTruong" runat="server" AddJQueryReference="True"
                                                    UseButtons="True" Width="99%" DataTextField="HoTen" DataValueField="IDs" DataSourceID="objNhanVien"
                                                    UseSelectAllNode="True">
                                                    <Style2 DropDownBoxBoxWidth="99%" />
                                                    <Texts SelectBoxCaption="Chọn tư vấn trưởng" />
                                                </asp:DropDownCheckBoxes>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:CommandField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="45px"
                                            ShowDeleteButton="True" DeleteText="Xóa" />
                                    </Columns>
                                    <FooterStyle BackColor="#6EA1C0" ForeColor="#000066" />
                                    <HeaderStyle BackColor="#6EA1C0" Font-Bold="True" ForeColor="White" Height="40px"
                                        HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                    <RowStyle ForeColor="#000066" Height="30px" />
                                    <SelectedRowStyle BackColor="#F1F1F1" Font-Bold="True" />
                                </asp:GridView>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div style="margin: 5px;">
                                    <asp:Button ID="btnAdd" runat="server" Text="Thêm nhà thầu" CssClass="btn btn-info"
                                        OnClick="btnAdd_Click" />
                                    <asp:Button ID="btnSave" ValidationGroup="Them" runat="server" Text="Lưu lại" CssClass="btn btn-primary"
                                        OnClick="btnSave_Click" />
                                    <asp:Button ID="btncapnhat" runat="server" Text="Cập nhật" CssClass="btn btn-info"
                                        OnClick="btncapnhat_Click" Visible="false" />
                                    <asp:Button ID="btnCancel" runat="server" Text="Nhập mới" CssClass="btn btn-warning"
                                        OnClick="btnCancel_Click" />
                                </div>
                            </td>
                        </tr>
                    </table>
                    <asp:ObjectDataSource ID="objNhaThau" runat="server" SelectMethod="GetNhaThau" TypeName="clsXuLy">
                    </asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="objGoiThau" runat="server" SelectMethod="GetGoiThau" TypeName="clsXuLy">
                    </asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="objNhanVien" runat="server" SelectMethod="GetNhanVien"
                        TypeName="clsXuLy"></asp:ObjectDataSource>
                    <asp:ValidationSummary ID="ValidationSummary1" HeaderText="Bạn phải nhập các trường sau:"
                        ShowMessageBox="true" ValidationGroup="Them" ShowSummary="false" EnableClientScript="true"
                        runat="server" />
                </div>
            </div>
            <div style="margin: 5px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <b>Danh sách dự án</b>
                    </div>
                    <div style="width: 100%; margin-top: 0px;" class="wrapper">
                        <asp:GridView ID="GV" runat="server" AutoGenerateColumns="false" BackColor="White"
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall"
                            Width="99%" OnRowCommand="GV_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbXoa" runat="server" Width="20px" Height="20px" ImageUrl="~/img/delete-24.png"
                                            OnClientClick="return confirm('Bạn chắc chắn muốn xóa ?')" CommandArgument='<%#Eval("IDs")%>'
                                            Text="Xóa" CommandName="Del" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Sửa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbSua" runat="server" Width="15px" Height="15px" ImageUrl="~/img/edit.ico"
                                            CommandArgument='<%#Eval("IDs")%>' Text="Sửa" CommandName="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="MaDuAn" ItemStyle-CssClass="padding" HeaderText="Mã dự án"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="TenDuAn" HeaderText="Tên dự án" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="ChuDauTu" HeaderText="Chủ đầu tư" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                    </div>
                </div>
            </div>
            <asp:HiddenField ID="hdID" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
